package com.qfedu.edu.exception.notify.observe.impl;

import com.qfedu.edu.exception.notify.observe.base.Observer;
import com.qfedu.edu.exception.notify.observe.base.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class SubjectImpl implements Subject {

    @Autowired

   private List<Observer> observers;


    @Override
    public void notifyMessage(String msg) {
        for (int i = 0; i < observers.size(); i++){
            Observer observer = observers.get(i);
            observer.notifyMessage(msg);
        }
    }
}
